C Programming Language

Console Input/Output Function

Console functions are the functions to receive input from keyword and write output to VDU (Visual Display Unit).


Unformated Console I/O Function

  • Unformatted I/O functions are used only for character datatype or character array/string and cannot be used for any other datatype

    These functions are used to read single input from the user at the console and it allows to display the value at console.

  • getch()
  • getch() is a pre-defined or built-in function present in the conio.h library.
    It returns the given character immediately without waiting for the entry key to be entered.
    By using getch() function, we can read a single character.
    By using getch() function we can pause the output console.
    The given character won’t be visible on the output screen.

  • The getch() function does not accept any parameter from the user
    It returns the ASCII value of the key pressed by the user as an input.


    Example:


  • putch()
  • The putch() function is used for printing character to a screen at current cursor location.
    It is unformatted character output function.
    It is defined in header file conio.h

  • where:
    character_variable   character / char(Variable Name)


  • Example:

     Video Lecture


  • getchar()
  • A getchar() function is a non-standard function whose meaning is already defined in the stdio.h header file to accept a single input from the user.
  • where:
    veriable_name    is a valid C name that has been declared as char type

    Example


  • putchar()
  • putchar() function is used to display one character at a time on the monitor


  • Example

     Video Lecture




  • gets()
  • gets() function is used to read a string of characters including whitespace.
    gets() function available in the header file.


  • where:
    s   any char variable name



  • Example


  • puts()
  • puts() function is a function used to display string on screen.
    puts() function declared the header file.


  • where:
    variable_name   any char variable name

  • Example


 Video Lecture



google Ads.